//
// Created by 孟令涛 on 24-7-15.
//

#ifndef DEMO1_GLOBALVARS_H
#define DEMO1_GLOBALVARS_H

#include "main.h"
//#include "FreeRTOS.h"
//#include "task.h"
//#include "queue.h"
//#include "semphr.h"
#include <stdbool.h>

//#define BT_BUFFER_SIZE 50
// ---------- 配置区 -----------------
#define LOW_BATTERY_VOLTAGE_MODE 1 // 低电量模式
#define JinJuLi 3.0f
// ------------------------------------

#define ZhongJuLi 5.0f
#define YuanJuLi 10.0f
#define JinYin 1 // 静音
#define NOFCHANEL 3
extern uint32_t Y_Out_Counter;
extern uint8_t Motor_Forward_Flag;
extern uint8_t movement_state;
//extern char bt_buffer[BT_BUFFER_SIZE];
//extern uint8_t bt_buffer_index;
//extern uint8_t command_ready;
extern uint8_t beepState;

#define LEFT1_PIN GPIO_PIN_14
#define LEFT2_PIN GPIO_PIN_13
#define RIGHT1_PIN GPIO_PIN_15
#define RIGHT2_PIN GPIO_PIN_12

#define LEFT1_PORT GPIOC
#define LEFT2_PORT GPIOC
#define RIGHT1_PORT GPIOC
#define RIGHT2_PORT GPIOB

extern float distance;

typedef enum {
    MODE_REMOTE = 10,
    MODE_LINE_FOLLOWING = 20,
    MODE_OBSTACLE_AVOIDANCE = 30,
    MODE_COLORFUL_LIGHT = 40,
    MODE_LIGHT_SEEKING = 50,
    MODE_FOLLOWING = 60,
} RobotMode;
extern RobotMode currentMode;
extern float batteryVoltage;

extern uint8_t fireSensor;
// 传感器状态变量
extern bool carControlLeft1, carControlLeft2, carControlRight1, carControlRight2;
extern uint8_t control_movement_state;
extern uint16_t carControl_left_speed;
extern uint16_t carControl_right_speed;

typedef enum {
    Middle_SERVO = 0,
    LEFT_SERVO = 1,
    RIGHT_SERVO = 2
} Servo_Type;

extern uint8_t servo_state;
extern int block_detection;
extern uint16_t r;
extern uint16_t g;
extern uint16_t b;
extern uint16_t adcValues[NOFCHANEL];
extern uint8_t fire_movement_state;
extern uint8_t fire_state;
#endif //DEMO1_GLOBALVARS_H
